//
//  KTHActContentV.m
//  KTLotteryTicket
//
//  Created by CoolKi on 16/3/5.
//  Copyright © 2016年 CoolKi. All rights reserved.
//

#import "KTHActContentV.h"

@implementation KTHActContentV

//触发代理方法
- (IBAction)clickXBtn:(id)sender {
    
    if ([self.delegate respondsToSelector:@selector(actContentView:)]) {
        [self.delegate actContentView:self];
    }
}

+(instancetype)showAtPoint:(CGPoint)point{
    //KTASK:这种从xib加载文件，是如何完成一个对象创建的三个步骤的，开辟内存空间，初始化实例对象，返回指针
    KTHActContentV * contentV = [[NSBundle mainBundle]loadNibNamed:@"KTHActContentV" owner:nil options:nil][0];
    contentV.center = point;
    [[UIApplication sharedApplication].keyWindow addSubview:contentV];
    return contentV;
}

//把self隐藏到 point 点
- (void)hidenInPoint:(CGPoint)point Completion:(void (^)())completion{
    [UIView animateWithDuration:0.3 animations:^{
        self.center = point;
        self.transform = CGAffineTransformMakeScale(0.001, 0.001);
    } completion:^(BOOL finished) {
        completion();
        [self removeFromSuperview];
    }];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
